package org.freespace.utils.enums;

public enum MachineStatus {

    IDLE(0, "闲置"),
    DOING(1, "使用中"),
    RESTARTING(2, "重启中"),
    UPGRADE(3, "升级中"),
    FAIL(4, "启动失败");

    private int type;
    private String name;

    MachineStatus(int type, String name){
        this.type = type;
        this.name = name;
    }

    public int getType() {
        return this.type;
    }
    public String getName() {
        return this.name;
    }


    public static String getNameByType(Integer type) {
        for (MachineStatus ms : MachineStatus.values()) {
            if (ms.getType() == type) {
                return ms.getName();
            }
        }
        return type+"";
    }
}
